import java.io.*;

public class FileGen {
	public static void main(String[] args) {
		if(args.length != 3) {
			System.out.println("Usage: FileGen <filename> <number of characters> <fast|slow>");
			System.exit(0);
		}
		String filename = args[0];
		int filesize = Integer.parseInt(args[1]);
		String method = args[2];
		
		/*
		 * Start making the file
		 */
		try {
			OutputStream output;
			if(method.equals("fast"))
				output = new BufferedOutputStream(new FileOutputStream(filename));
			else
				output = new FileOutputStream(filename);
				
			FileDump dumper = new FileDump(output);
			long duration = dumper.dump(filesize);
			System.out.println("Dumped " + filesize + " bytes in " + duration + " ms.");
			output.close();
		} catch(IOException e) {
			System.out.println("Error: " + e);
		}
	}
}
